#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys, urllib
import lxml.html as H

reload(sys)

url = "http://www.net.cn/static/customercare/yourIP.asp"
wp = urllib.urlopen(url)
content = wp.read()

doc = H.document_fromstring(content)
#print H.tostring(doc)
center=doc.xpath("//center/h2")
#ip = doc.xpath("//table/h2")
#print center.get('href')
fp = open("a.txt","w")
print center[0].text_content().strip()
fp.write( center[0].text_content().strip())
fp.close()
